From 94384ea4e0f8743dd922b6eb1e1c9de790069a95 Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 14 Dec 2005 21:17:30 +0000 Subject: [PATCH] Sketch in example of converting waypoints to tracks. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@1653 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/cvttypes.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 gpsbabel/cvttypes.c diff --git a/gpsbabel/cvttypes.c b/gpsbabel/cvttypes.c new file mode 100644 index 000000000..b17cf7395 --- /dev/null +++ b/gpsbabel/cvttypes.c @@ -0,0 +1,76 @@ +/* + + Convert data between waypoints, tracks, and routes. + + Copyright (C) 2005 Robert Lipe + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA + + */ + +#include "defs.h" +#include "filterdefs.h" + +#define MYNAME "cvttype" + +static char *action; +static route_head *my_trk_head; + +static +arglist_t cvttype_skeleton_args[] = { + {"action", &action, "Type of conversion to perform", "wpttotrk", + ARGTYPE_STRING} , + {0, 0, 0, 0, 0} +}; + +static void +cvttype_skeleton_init(const char *args) +{ + my_trk_head = route_head_alloc(); +// route or track + track_add_head(my_trk_head); +} + +static void +cvttype_skeleton_process(void) +{ + queue *elem, *tmp; + waypoint *wpt; + + QUEUE_FOR_EACH(&waypt_head, elem, tmp) { + waypoint *wpt = (waypoint *)elem; + +// if action == to trk + waypt_del(wpt); + route_add_wpt(my_trk_head, wpt); +// if action == to rte +// waypt_del(wpt); +// route_add_wpt(my_rte_head, wpt); + + } +} + +static void +cvttype_skeleton_deinit(void) +{ +} + +filter_vecs_t cvttype_vecs = { + cvttype_skeleton_init, + cvttype_skeleton_process, + cvttype_skeleton_deinit, + NULL, + cvttype_skeleton_args +}; -- 2.30.2